<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Customer</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="" lay-filter="table-search">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">记录时间</label>
                            <div class="layui-input-inline">
                                <input type="text" name="createDateBegin" id="createTime0"
                                       placeholder="开始时间" autocomplete="off" class="layui-input" />
                                <input type="text" name="createDateEnd" id="createTime1"
                                       placeholder="截止时间" autocomplete="off" class="layui-input" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">包号</label>
                            <div class="layui-input-inline">
                                <input type="number" name="packageNo" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">长ID</label>
                            <div class="layui-input-inline">
                                <input type="number" name="customerId" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">登录账号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="phone" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">IP[换行]</label>
                            <div class="layui-input-inline">
                                <textarea name="iPs"></textarea>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">长id[换行]</label>
                            <div class="layui-input-inline">
                                <textarea name="customerIds"></textarea>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">账号[换行]</label>
                            <div class="layui-input-inline">
                                <textarea name="phones"></textarea>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

    </div>
</div>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="export" >导出</button>

    </div>
</script>

<script type="text/html" id="currentTableBar">

</script>

<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/js/common.js?v=5" charset="utf-8"></script>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;
            laydate=layui.laydate;

        laydate.render({
            elem: '#createTime0',
            value: getYmd(0)
        });
        laydate.render({
            elem: '#createTime1',
            value: getYmd(1)
        })


        table.render({
            elem: '#currentTableId',
            url: '/admin/customerLogin/paginate',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'print'],
            cols: [[
                {type: "checkbox", width: 50},
                {field: 'customer_id', width: 180, title: 'ID', sort: true},
                {field: 'channel', title: '账号渠道'},
                {field: 'cid', width: 200,title: '登录账号'},
                {field: 'password', width: 200,title: '登录密码'},
                {field: 'packageNo', title: '包号'},
                {field: 'ip', title: 'IP'},
                {field: 'logindate', title: '登录时间'},
                {field: 'serverid', title:'最后登录区服' },
                {field: 'uuid', title:'渠道ID' },
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,
            skin: 'line'
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var searchData = data.field;
            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where:searchData
            }, 'data');
            return false;
        });


        table.on('toolbar(currentTableFilter)', function (obj) {
            if(obj.event === 'export'){ //导出
                var searchData = form.val('table-search');
                searchData.page = 1;
                searchData.limit = 9999999;
                var layerIndex = layer.msg("请求中请耐心等待...",{icon:16,time:999999999});
                $.get('/admin/customerLogin/export',searchData,function(res){
                    layer.close(layerIndex)
                    browserDownload("/" + res.data);
                });
            }
        });


    });
</script>
</body>
</html>